/*
 * DiscoverySearchActivity.java
 * business
 *
 * Created by chentao on 2017/4/21.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.main.discovery.search;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.data.model.ArticleModel;
import com.yidiandao.business.data.model.DiscoverySearchModel;
import com.yidiandao.business.utils.ActivityUtils;

/**
 * 发现页 - 搜索 - 一级页面
 * <p>
 * Created by ChenTao(chentao7v@gmail.com) on 2017/4/12 0012 18:22
 */
public class DiscoverySearchActivity extends BaseActivity {

    private DiscoverySearchFragment mSearchFragment;

    public static void actionStart(Activity activity) {
        Intent intent = new Intent(activity, DiscoverySearchActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mSearchFragment = (DiscoverySearchFragment) getSupportFragmentManager().findFragmentById(R.id.container_discovery_search);
        if (mSearchFragment == null) {
            mSearchFragment = DiscoverySearchFragment.getInstance();
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), mSearchFragment, R.id.container_discovery_search);
        }
    }

    @Override
    protected void initPresenter() {
        new DiscoverySearchPresenter(mSearchFragment, new DiscoverySearchModel(), new ArticleModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_discovery_search;
    }
}
